package edu.upc.clase.demo.dao;

import edu.upc.clase.demo.entity.Alquiler;
import java.util.Date;
import java.util.List;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.util.*;

/**
 *
 * @author Omar
 */
public interface AlquilerCanchaDao {

    //BaseDAO base;
    public Integer insertar(Alquiler alquiler);

    public Alquiler buscarporId(Alquiler alquiler);

    public List<Alquiler> listar(Alquiler alquiler, Date fechaInicio, Date fechaFinal);

    public Alquiler buscarporFechaLocal(Alquiler alquiler);
}

    /*public AlquilerCanchaDao() {
    }

    public Integer insertar(Alquiler alquiler) throws FulbitoFacilException {
        try {
        String insert = "insert into ZALQCANCH(NROITEM,IDCAN,IDLOCAL,FECRESER,HHINI,HHFIN,TOTALQU) "
                + "values (?,?,?,?,?,?,?)";

        List list = new ArrayList();

        list.add(alquiler.getNROITEM());
        list.add(alquiler.getIDCAN());
        list.add(alquiler.getIDLOCAL());
        list.add(alquiler.getFECRESER());
        list.add(alquiler.getHHINI());
        list.add(alquiler.getHHFIN());
        list.add(alquiler.getTOTALQU());

        base = new BaseDAO();
        return base.insert(insert, list);
        } catch (Exception e) {
            throw new FulbitoFacilException(e.getMessage());
        }
    }

    public Alquiler Buscar(Alquiler alquiler) throws FulbitoFacilException, SQLException {

        String Select = "select NROITEM from ZALQCANCH where nroitem = '" + alquiler.getNROITEM() + "'";
        //Select = String.format(Select, alquiler.getNROITEM());

        Alquiler alquilerRetorno = new Alquiler();

        base = new BaseDAO();

        ResultSet rs = base.select(Select);

        /*** Recorrer fila a fila el resultado ****
        while (rs.next()) {
            alquilerRetorno.setNROITEM(rs.getString("NROITEM"));
            return alquilerRetorno;
        }
        return null;
    }*/
//}
